草庐IT

c++ - Qt Release build 给出 MSVC++ Runtime Library Error

全部标签

c++ - MSVC 2017 下缺少 C11 strerrorlen_s 函数

我正在尝试从C11standard中为strerrorlen_s函数查找要包含的headerMSVC2017下。我需要它来为使用strerror_s获得的错误消息分配空间。代码如下:autosize=strerrorlen_s(errno)+1;char*errorReason=(char*)alloca(size);strerror_s(errorReason,size,errno);std::ostringstreamoss;oss在文档中有以下文字:Aswithallbounds-checkedfunctions,strerror_sandstrerrorlen_sareonly

c++ - MSVC 2017 下缺少 C11 strerrorlen_s 函数

我正在尝试从C11standard中为strerrorlen_s函数查找要包含的headerMSVC2017下。我需要它来为使用strerror_s获得的错误消息分配空间。代码如下:autosize=strerrorlen_s(errno)+1;char*errorReason=(char*)alloca(size);strerror_s(errorReason,size,errno);std::ostringstreamoss;oss在文档中有以下文字:Aswithallbounds-checkedfunctions,strerror_sandstrerrorlen_sareonly

c++ - MSVC 中的虚拟继承错误

看来我的问题是MSVC中的错误。我正在使用带有ServicePack1的VisualStudio2008,并且我的代码适用于GCC(在codepad.org上测试过)。关于这个错误的任何官方信息?任何想法如何解决它?VS2010中的bug修复了吗?我们将不胜感激所有见解。代码:structBase{Base(inti=0):i(i){}virtual~Base(){}virtualBase*clone()const=0;protected:inti;};structA:virtualpublicBase{A(){}virtualA*clone()const=0;};structB:pu

c++ - MSVC 中的虚拟继承错误

看来我的问题是MSVC中的错误。我正在使用带有ServicePack1的VisualStudio2008,并且我的代码适用于GCC(在codepad.org上测试过)。关于这个错误的任何官方信息?任何想法如何解决它?VS2010中的bug修复了吗?我们将不胜感激所有见解。代码:structBase{Base(inti=0):i(i){}virtual~Base(){}virtualBase*clone()const=0;protected:inti;};structA:virtualpublicBase{A(){}virtualA*clone()const=0;};structB:pu

c++ - 为什么用非常量声明静态变量不会在g++中给出错误

intmain(){inta=1;staticintb=a;}这段代码在gcc4.3.2中给出了错误error:initializerelementisnotconstant.但它在g++4.3.2上运行良好。有人请解释为什么这在g++4.3.2中没有给出错误。 最佳答案 因为它在C++中有效(在C中无效)。(C++11,6.7p4)"Constantinitialization(3.6.2)ofablock-scopeentitywithstaticstorageduration,ifapplicable,isperformedb

c++ - 为什么用非常量声明静态变量不会在g++中给出错误

intmain(){inta=1;staticintb=a;}这段代码在gcc4.3.2中给出了错误error:initializerelementisnotconstant.但它在g++4.3.2上运行良好。有人请解释为什么这在g++4.3.2中没有给出错误。 最佳答案 因为它在C++中有效(在C中无效)。(C++11,6.7p4)"Constantinitialization(3.6.2)ofablock-scopeentitywithstaticstorageduration,ifapplicable,isperformedb

c++ - 将 `std::floor()` 和 `std::ceil()` 转换为整数类型是否总是给出正确的结果?

我很怀疑这些函数之一可能会给出这样的错误结果:std::floor(2000.0/1000.0)-->std::floor(1.999999999999)-->1orstd::ceil(18/3)-->std::ceil(6.000000000001)-->7这样的事情会发生吗?如果确实存在这样的风险,我打算使用下面的功能来安全地工作。但是,这真的有必要吗?constexprlongdoubleEPSILON=1e-10;intmax_tGuaranteedFloor(constlongdouble&Number){if(Number>0){returnstatic_cast(std:

c++ - 将 `std::floor()` 和 `std::ceil()` 转换为整数类型是否总是给出正确的结果?

我很怀疑这些函数之一可能会给出这样的错误结果:std::floor(2000.0/1000.0)-->std::floor(1.999999999999)-->1orstd::ceil(18/3)-->std::ceil(6.000000000001)-->7这样的事情会发生吗?如果确实存在这样的风险,我打算使用下面的功能来安全地工作。但是,这真的有必要吗?constexprlongdoubleEPSILON=1e-10;intmax_tGuaranteedFloor(constlongdouble&Number){if(Number>0){returnstatic_cast(std:

c++ - 使用 extern c 和 dllexport 与模块定义 (msvc++) 进行标准调用名称修改

我试图为dll导出一个简单的测试函数,以便与指定调用约定为的应用程序(仅供引用:mIRC)一起使用:int__stdcalltest_func(HWNDmWnd,HWNDaWnd,char*data,char*parms,BOOLshow,BOOLnopause)现在,要从应用程序中调用它,我会使用test_func,但我注意到由于名称修改,它并不像我想象的那么简单。通过此处的类似主题,我了解到将extern"C"与__declspec(dllexport)结合使用是一种等效的(某种程度上)消除重整的方法到模块定义(.def)。但是,当使用extern/dllexport方法时,我的函

c++ - 使用 extern c 和 dllexport 与模块定义 (msvc++) 进行标准调用名称修改

我试图为dll导出一个简单的测试函数,以便与指定调用约定为的应用程序(仅供引用:mIRC)一起使用:int__stdcalltest_func(HWNDmWnd,HWNDaWnd,char*data,char*parms,BOOLshow,BOOLnopause)现在,要从应用程序中调用它,我会使用test_func,但我注意到由于名称修改,它并不像我想象的那么简单。通过此处的类似主题,我了解到将extern"C"与__declspec(dllexport)结合使用是一种等效的(某种程度上)消除重整的方法到模块定义(.def)。但是,当使用extern/dllexport方法时,我的函